package com.fzrskj.cloud.free.core.enums;

/**
 * UserCertifyEnum.
 *
 * @author zj.
 *         Created on 2018/12/21 0021.
 */
public enum UserCertifyEnum {
    /**
     * 未提交.
     */
    NEVER(0, "未提交"),
    /**
     * 拒绝通过.
     */
    REFUSED(1, "已拒绝"),
    /**
     * 审核中.
     */
    CERTIFYING(2, "待审核"),
    /**
     * 已通过.
     */
    CERTIFIED(3, "已认证");

    /**
     * 状态值.
     */
    private Integer state;

    /**
     * 状诚名称.
     */
    private String stateName;

    /**
     * 认证状态.
     * @param state 状态值.
     */
    UserCertifyEnum(Integer state, String stateName) {
        this.state = state;
        this.stateName = stateName;
    }

    /**
     * 获取状态.
     * @return state.
     */
    public Integer getState() {
        return this.state;
    }

    /**
     * 获取状态名称.
     * @return stateName.
     */
    public String getStateName() {
        return this.stateName;
    }

    /**
     * 通过状态值获取状态名称.
     * @param state state value.
     * @return state name.
     */
    public static String getStateName(Integer state) {
        for (UserCertifyEnum item : UserCertifyEnum.values()) {
            if (item.getState().equals(state)) {
                return item.getStateName();
            }
        }
        return null;
    }
}
